package com.yaoran.userauth.controller;

import com.yaoran.userauth.service.LoginService;
import com.yaoran.userauth.utils.R;
import com.yaoran.userauth.vo.request.UserRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "用户登录")
@RestController
@RequestMapping("")
@Slf4j
public class LoginController {
    private final static Logger logger = LoggerFactory.getLogger(LoginController.class);
    @Autowired private LoginService loginService;

    @ApiOperation(value = "用户登录")
    @PostMapping("/login")
    public R<UserRequest> authLogin(@RequestBody UserRequest userRequest){
        log.info("开始登录："+userRequest);
        return loginService.authLogin(userRequest);
    }
}
